package com.tengju.data.infrastructure.repository.convert;

import com.tengju.data.domain.model.user.ReportDealerDominationNewUserInfo;
import com.tengju.data.domain.model.user.ReportDealerNewUserInfo;
import com.tengju.data.domain.model.user.UserIdCode;
import com.tengju.data.infrastructure.persistence.mybatis.dataobject.ReportDealerDominationNewUserDO;
import com.tengju.data.infrastructure.persistence.mybatis.dataobject.ReportDealerNewUserDO;


public class ReportDealerDominationNewUserConvert {

    public static ReportDealerDominationNewUserInfo toModel(ReportDealerDominationNewUserDO reportDealerNewUserDO) {
        if (reportDealerNewUserDO == null) {
            return null;
        }
        return new ReportDealerDominationNewUserInfo(
                new UserIdCode(reportDealerNewUserDO.getIdCode()),
                reportDealerNewUserDO.getLevel5NewCnt() == null ? 0L : reportDealerNewUserDO.getLevel5NewCnt(),
                reportDealerNewUserDO.getLevel2NewCnt() == null ? 0L :reportDealerNewUserDO.getLevel2NewCnt(),
                reportDealerNewUserDO.getLevel3NewCnt() == null ? 0L : reportDealerNewUserDO.getLevel3NewCnt(),
                reportDealerNewUserDO.getLevel4NewCnt() == null ? 0L : reportDealerNewUserDO.getLevel4NewCnt(),
                reportDealerNewUserDO.getLevel1NewCnt() == null ? 0L : reportDealerNewUserDO.getLevel1NewCnt(),
                reportDealerNewUserDO.getYear(),
                reportDealerNewUserDO.getMonth()
        );

    }
}
